package com.wxzz.elearing.pay.api.admin;


import com.wxzz.elearing.pay.dto.ListWxUserActivityDto;
import com.wxzz.elearing.pay.dto.SelectAllOrderStatisticsVoByTypeDto;
import com.wxzz.elearing.pay.dto.UserOrderByCurriculumDto;
import com.wxzz.elearing.pay.dto.UserOrderDto;
import com.wxzz.elearing.pay.entity.UserOrder;
import com.wxzz.elearing.pay.service.IUserOrderService;
import com.wxzz.elearing.pay.vo.ActivityStatisticsVo;
import com.wxzz.elearing.pay.vo.AllOrderStatisticsTypeVo;
import com.wxzz.elearing.pay.vo.AllOrderStatisticsVo;
import com.wxzz.elearing.pay.vo.UserOrderByCurriculumVo;
import com.wxzz.elearning.common.dto.ActivityStatisticsDto;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户订单表 前端控制器
 * </p>
 *
 * @author
 * @since 2021-04-23
 */
@RestController
@RequestMapping("/user-order")
@Api(tags = "订单列表(后台)")
public class UserOrderController {

    @Autowired
    private IUserOrderService userOrderService;


    @ApiOperation(value = "订单列表(总后台)", notes = "订单列表(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "listUserOrder", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<UserOrder>> listUserOrder(@RequestBody UserOrderDto userOrderDto) {
        return userOrderService.listUserOrder(userOrderDto);
    }


    @ApiOperation(value = "根据订单id查询订单(后台)", notes = "根据订单id查询订单(后台)", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "selectPayStatus/{userOrderId}", method = RequestMethod.POST)
    public ReturnVO<UserOrder> selectPayStatus(@PathVariable Long userOrderId) {
        return userOrderService.selectPayStatus(userOrderId);
    }

    @ApiOperation(value = "根据课程id查询销售列表(后台)", notes = "根据课程id查询销售列表(后台)", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "selectUserOrderByCurriculum", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<UserOrder>>> selectUserOrderByCurriculum(@RequestBody UserOrderByCurriculumDto userOrderByCurriculumDto) {
        return userOrderService.selectUserOrderByCurriculum(userOrderByCurriculumDto);
    }

    @ApiOperation(value = "根据课程id查询销售情况统计(后台)", notes = "根据课程id查询销售情况统计(后台)", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "selectUserOrderByCurriculumVo/{curriculumId}", method = RequestMethod.POST)
    public ReturnVO<UserOrderByCurriculumVo> selectUserOrderByCurriculumVo(@PathVariable Long curriculumId) {
        return userOrderService.selectUserOrderByCurriculumVo(curriculumId);
    }

    @ApiOperation(value = "查看活动销售统计数据(后台)", notes = "查看活动销售统计数据(后台)", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "/selectActivityStatisticsVo/{activityId}", method = RequestMethod.POST)
    public ReturnVO<ActivityStatisticsVo> selectActivityStatisticsVo(@PathVariable Long activityId) {
        return userOrderService.selectActivityStatisticsVo(activityId);
    }

    @ApiOperation(value = "活动销售记录(后台)", notes = "活动销售记录(后台)", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "/listUserOrderIdByActivity", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<UserOrder>>> listUserOrderIdByActivity(@RequestBody ListWxUserActivityDto listWxUserActivityDto) {
        return userOrderService.listUserOrderIdByActivity(listWxUserActivityDto);
    }

    @ApiOperation(value = "概况总览(营业数据/交易数量)(总后台)", notes = "概况总览(营业数据/交易数量)(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "/selectAllOrderStatisticsVo", method = RequestMethod.POST)
    public ReturnVO<AllOrderStatisticsVo> selectAllOrderStatisticsVo() {
        return userOrderService.selectAllOrderStatisticsVo();
    }

    @ApiOperation(value = "概况总览(营业额分类统计)(总后台)", notes = "概况总览(营业额分类统计)(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "/selectAllOrderStatisticsVoByType", method = RequestMethod.POST)
    public ReturnVO<AllOrderStatisticsTypeVo> selectAllOrderStatisticsVoByType(@RequestBody SelectAllOrderStatisticsVoByTypeDto selectAllOrderStatisticsVoByTypeDto) {
        return userOrderService.selectAllOrderStatisticsVoByType(selectAllOrderStatisticsVoByTypeDto);
    }

}
